package com.fsserver.core.service;

import com.fsserver.core.dto.PaymentRequestDTO;
import com.fsserver.core.dto.ReconciliationRequestDTO;
import com.fsserver.core.dto.RefundRequestDTO;
import com.fsserver.core.entity.PaymentTransaction;
import com.fsserver.core.entity.Reconciliation;
import com.fsserver.core.entity.Refund;
import com.fsserver.core.vo.PaymentResponseVO;
import com.fsserver.core.vo.ReconciliationResponseVO;
import com.fsserver.core.vo.RefundResponseVO;

import java.util.Date;
import java.util.Map;

/**
 * 支付策略接口
 * Payment Strategy
 *
 * @author fsserver
 */
public interface PaymentStrategy {

    /**
     * 获取支付类型
     * Get payment type
     *
     * @return 支付类型
     */
    String getPaymentType();

    /**
     * 创建支付
     * Create payment
     *
     * @param paymentRequestDTO 支付请求DTO
     * @param paymentTransaction 支付交易
     * @return 支付响应
     */
    PaymentResponseVO createPayment(PaymentRequestDTO paymentRequestDTO, PaymentTransaction paymentTransaction);

    /**
     * 查询支付
     * Query payment
     *
     * @param orderNo 订单号
     * @param transactionNo 交易号
     * @return 支付交易
     */
    PaymentTransaction queryPayment(String orderNo, String transactionNo);

    /**
     * 关闭支付
     * Close payment
     *
     * @param orderNo 订单号
     * @param transactionNo 交易号
     * @return 是否成功
     */
    boolean closePayment(String orderNo, String transactionNo);

    /**
     * 处理支付通知
     * Handle payment notification
     *
     * @param params 通知参数
     * @return 支付交易
     */
    PaymentTransaction handlePaymentNotification(Map<String, String> params);

    /**
     * 创建退款
     * Create refund
     *
     * @param refundRequestDTO 退款请求DTO
     * @param refund 退款
     * @return 退款响应
     */
    RefundResponseVO createRefund(RefundRequestDTO refundRequestDTO, Refund refund);

    /**
     * 查询退款
     * Query refund
     *
     * @param refundNo 退款号
     * @return 退款
     */
    Refund queryRefund(String refundNo);

    /**
     * 处理退款通知
     * Handle refund notification
     *
     * @param params 通知参数
     * @return 退款
     */
    Refund handleRefundNotification(Map<String, String> params);

    /**
     * 创建对账
     * Create reconciliation
     *
     * @param reconciliationRequestDTO 对账请求DTO
     * @param reconciliation 对账
     * @return 对账响应
     */
    ReconciliationResponseVO createReconciliation(ReconciliationRequestDTO reconciliationRequestDTO, Reconciliation reconciliation);

    /**
     * 执行对账
     * Execute reconciliation
     *
     * @param reconciliation 对账
     * @return 是否成功
     */
    boolean executeReconciliation(Reconciliation reconciliation);

    /**
     * 对账
     * Reconciliation
     *
     * @param reconciliationDate 对账日期
     * @return 对账数据
     */
    String reconciliation(Date reconciliationDate);
} 